package org.example.api.pc;

import org.example.R.R;
import org.example.entity.dto.AddVolunteerWorkDto;
import org.example.service.pc.VolunteerWorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/api/pc/volunteer")
public class PCVolunteerWorkController {

    @Autowired
    private VolunteerWorkService volunteerWorkService;

    @PostMapping("/list")
    public R list() {
        return volunteerWorkService.pcList();
    }

    @PostMapping("/add")
    public R add(@Valid @RequestBody AddVolunteerWorkDto dto){
        return volunteerWorkService.add(dto);
    }

    @PostMapping("/detail")
    public R detail(@RequestParam("id") Long id) {
        return volunteerWorkService.detail(id);
    }

}
